<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<link rel="stylesheet" href="../static/zyc/css/emp-individual.css?<%=Math.random()%>">
	<script type="text/javascript">
		$(".ind_sic div").dblclick(function (){
			var the = $(this);
			if(the.find("span").text()=="住址："&&the.find("span").text()!="职位："&&the.find("span").text()!="账号："&&the.find("span").text()!="名称："){
				if($(".ind_sic input").length==0){
					$(".ind_bot").append("<button class='green' onclick='indivfind()'>保存</button>"+
					"<button class='red' onclick='adds(\"个人详情\",\"zyc/emp-individual\")'>重置</button>");
				}
				if(the.find("input").length==0){
					var text = the.find("p").text();
					var zd = the.find("p").attr("id");
					var html = "";
					if(zd=="sex"){
						html = "<select id='sex'><option value ='1'>男</option><option value ='2'>女</option><option value ='3'>其他</option></select><br/>";
					}else{
						html = "<input type='text' id='"+zd+"' value='"+text+"'>";
					}
					the.find("p").remove();
					the.append(html);
				}
			}
		});
		$(".ind_t_t1 li").dblclick(function (){
			var the = $(this);
			if(the.index()+1<$(".ind_t_t1 ul li").length){
				var it = the.index();
				var id = the.find("span").attr("id");
				var html = "";
				$.ajax({
					url: "indivfind_lxfs",
					success: function(data){
						for(var i=0;data.length>i;i++){
							html = html+"<option id='"+data[i]['lxfsid']+"' value ='"+data[i]['lxfs']+"'>"+data[i]['lxfs']+"</option>";
							//alert(data[i]['lxfs']);
						}
						html = "<select class='lxfs_sel'>"+html+"</select>"
						the.replaceWith("<li>"+html+"<input type='text' id='"+id+"'><button class='small_green' onclick='addemplx("+(it)+")'>确定</button></li>");
					}
				});
			}
		});
		function indivfind() {
			var it = $(".ind_sic input").length;
			if($(".ind_sic select").length==1){
				var text = $(".ind_sic select").val();
				var zd = $(".ind_sic select").attr("id");
				//alert(text+":"+zd);
				$.ajax({
					url: "indivfind",
					data:{
						text:text,
						zd:zd
					}
				});
			}
			for(var i=0;i<it;i++){
				var text = $(".ind_sic input:eq("+i+")").val();
				var zd = $(".ind_sic input:eq("+i+")").attr("id");
				//alert(text+":"+zd);
				$.ajax({
					url: "indivfind",
					data:{
						text:text,
						zd:zd
					}
				});
			}
			adds("个人详情","zyc/emp-individual");
		}
		function addlxfs() {
			var it = $(".ind_t_t1 ul li").length;
			var html = "";
			$.ajax({
				url: "indivfind_lxfs",
				success: function(data){
					for(var i=0;data.length>i;i++){
						html = html+"<option id='"+data[i]['lxfsid']+"' value ='"+data[i]['lxfs']+"'>"+data[i]['lxfs']+"</option>";
						//alert(data[i]['lxfs']);
					}
					html = "<select class='lxfs_sel'>"+html+"</select>"
					$(".addemplx").before("<li>"+html+"<input type='text' id='0'><button class='small_green' onclick='addemplx("+(it-1)+")'>确定</button></li>");
				}
			});
			//alert($(".addemplx").html());
		}
		function addemplx(j) {
			var li = $(".ind_t_t1 ul li:eq("+j+")");
			var lxfs = li.find(".lxfs_sel").val();
			var lxxx = li.find("input").val();
			var lxxxid = li.find("input").attr("id");
			$.ajax({
				url: "indivfind_addlx",
				data:{
					lxfs:lxfs,
					lxxx:lxxx,
					lxxxid:lxxxid
				},
				success: function(data){
					li.replaceWith("<li>"+lxfs+"："+"<span id=''"+data+"''>"+lxxx+"</span></li>");
				}
			});
		}
	</script>
	<script type="text/javascript" src="../static/zyc/js/emp-individual.js"></script>
	<div class="full_scr bj_home">
		<div class="bj_img" style="background-image:${hopa.perPmsZts[0].ztback}"></div>
		<div class="bj_txt">
			<div class="bj_small bj_s_w7">
				<div class="ind_box">
					<div class="ind_sic len">
						<div><span>名称：</span><p id="null">${hopa.empname}</p></div>
						<div><span>国籍：</span><p id="null">${empdet.perPmsEmpdets[0].detgj}</p></div>
						<div><span>账号：</span><p id="null">${empdet.perPmsActs[0].actaccount}</p></div>
						<div><span>名族：</span><p id="null">${empdet.perPmsEmpdets[0].detmz}</p></div>
						<div><span>性别：</span><p id="null">${empdet.perPmsEmpdets[0].perPmsSex.sex}</p></div>
						<div><span>部门：</span><p id="null">${empdet.perPmsStms[0].perPmsDept.deptname}</p></div>
						<div><span>身份证：</span><p id="null">${empdet.empcard}</p></div>
						<div><span>职位：</span><p id="null">${empdet.perPmsStms[0].perPmsPot.potzw}</p></div>
						<div><span>生日：</span><p id="null">${empdet.perPmsEmpdets[0].detsr}</p></div>
						<div><span>住址：</span><p id="dizi">${empdet.perPmsEmpdets[0].detzz}</p></div>
					</div>
					<div class="ind_img len">
						<div>
							<img id="TX_finalImg" src="${empdet.perPmsZts[0].zthost}"/>
							<div class="none">更换头像</div>
						</div>
						<a onClick="TX_open()">拍照</a>
						<div id="GenHuanTouXioang" class="easyui-window" title="更换头像" style="width:600px;height:400px"data-options="closed:true,minimizable:false,maximizable:false,collapsible:false,resizable: false,draggable:false,modal:true">
			    		    <div class="TX_box">
	                            <video id="TX_video" src=""></video>
	                        	<canvas id='TX_canvas' class="hide" width="250px" height="250px"></canvas>
	                            <button class='TX_pai_show'>拍照</button>
	                            <button class="TX_pai_close" onClick="TX_funClose()">关闭</button>
	                        </div>
		    			</div>
					</div>
					<div class="ind_tex len">
						<div class="ind_t_t1 len">
							<p>联系方式</p>
							<ul>
								<c:forEach items="${empdet.perPmsEmplxs}" var="s">
									<li>
										${s.perPmsLxf.lxfs}：
										<span id="${s.lxid}">${s.lxphone}</span>
									</li>
								</c:forEach>
								<li class="addemplx">
									<button class="small_green none" onclick="addlxfs()">添加</button>
								</li>
							</ul>
						</div>
						<div class="ind_t_t2 len">
							<p>证书</p>
							<ul>
								<li><span></span></li>
							</ul>
						</div>
					</div>
					<div class="ind_bot">
					
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>